package com.it.controller;

import com.it.pojo.Address;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import  com.it.pojo.Result;
import java.util.ArrayList;
import java.util.List;

//测试响应数据
@RestController
public class ResponseController {

    @RequestMapping("/helloworld")
    public Result hello() {
        System.out.println("hello world~");
        return Result.success("hello world~");
    }

    @RequestMapping("/getAddr")
    public Result getAddr() {
        Address addr = new Address();
        addr.setProvince("广东");
        addr.setCity("深圳");
        return Result.success(addr);
    }

    @RequestMapping("/listAddr")
    public Result listAddr() {
        List<Address> list = new ArrayList<Address>();

        Address addr = new Address();
        addr.setProvince("广东");
        addr.setCity("深圳");

        Address addr1 = new Address();
        addr1.setProvince("陕西");
        addr1.setCity("西安");

        list.add(addr);
        list.add(addr1);
        return Result.success(list);
    }
}
